const response = {
  status: 200,
  message: '获取商品分类列表成功',
  meta: {
    total: 3,
    pagesize: 5,
    pagenum: 1
  },
  // cat_name: 分类名称  cat_pid: 分类父ID
  // cat_level: 分类当前层级  cat_deleted:是否有效
  objects: [
    {
      cat_id: 1,
      cat_name: '大家电',
      cat_pid: 0,
      cat_level: 0,
      cat_deleted: false,
      children: [
        {
          cat_id: 3,
          cat_name: '电视',
          cat_pid: 1,
          cat_level: 1,
          cat_deleted: false,
          children: [
            {
              cat_id: 6,
              cat_name: '曲面电视',
              cat_pid: 3,
              cat_level: 2,
              cat_deleted: false
            },
            {
              cat_id: 7,
              cat_name: 'TCL',
              cat_pid: 3,
              cat_level: 2,
              cat_deleted: true
            },
            {
              cat_id: 8,
              cat_name: '创维',
              cat_pid: 3,
              cat_level: 2,
              cat_deleted: false
            },
            {
              cat_id: 9,
              cat_name: '小米',
              cat_pid: 3,
              cat_level: 2,
              cat_deleted: false
            }
          ]
        },
        {
          cat_id: 4,
          cat_name: '空调',
          cat_pid: 1,
          cat_level: 1,
          cat_deleted: false,
          children: [
            {
              cat_id: 16,
              cat_name: '格力',
              cat_pid: 3,
              cat_level: 2,
              cat_deleted: false
            },
            {
              cat_id: 17,
              cat_name: '美的',
              cat_pid: 3,
              cat_level: 2,
              cat_deleted: true
            },
            {
              cat_id: 18,
              cat_name: '海尔',
              cat_pid: 3,
              cat_level: 2,
              cat_deleted: false
            },
            {
              cat_id: 19,
              cat_name: '小米',
              cat_pid: 3,
              cat_level: 2,
              cat_deleted: false
            }
          ]
        }
      ]
    },
    {
      cat_id: 111,
      cat_name: '热门推荐',
      cat_pid: 0,
      cat_level: 0,
      cat_deleted: false,
      children: [
        {
          cat_id: 1111,
          cat_name: '人工智能',
          cat_pid: 111,
          cat_level: 1,
          cat_deleted: false
        },
        {
          cat_id: 2222,
          cat_name: '大数据',
          cat_pid: 111,
          cat_level: 1,
          cat_deleted: false
        }
      ]
    }
  ]
}

const parentList = {
  status: 200,
  message: '获取父级分类成功',
  meta: {
    total: 3,
    pagesize: 5,
    pagenum: 1
  },
  objects: response.objects
}

const attributes = {
  status: 200,
  message: '获取参数列表成功',
  meta: {
    total: 3,
    pagesize: 5,
    pagenum: 1
  },
  objects: {
    dynamic: [
      {
        attr_name: '版式',
        attr_vals: '55吋超薄4k曲面 55吋超薄4k 55吋超薄2k曲面 55吋超薄2k'
      },
      {
        attr_name: '颜色',
        attr_vals: '红 橙 黄 绿 青 蓝 紫'
      }
    ],
    static: [
      {
        attr_name: '主体-商品名称'
      },
      {
        attr_name: '显示-曲面'
      },
      {
        attr_name: '系统-智能电视'
      },
      {
        attr_name: '外观-壁挂安装'
      }
    ]
  }
}

export default {
  'get|categories': option => {
    if (option.url.indexOf('/api/v1/categories?type=2') > -1) {
      return parentList
    }
    return response
  },
  'get|categories/(?<id>\\d+)/attributes': option => {
    return attributes
  }
}
